<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .test{
      width: 200px;
      height: 200px;
      background-color: blue;
    }
    .test2{
      width: 200px;
      height: 200px;
      background: yellow;
    }
  </style>
</head>
<body>
  <div id="app">
    <div v-bind:class='toggle?"test":"test2"'></div>
    <button @click="change">改变颜色</button>
  </div>
</body>
<script src="./vue.js"></script>
<script>

  let vm = new Vue({
    el:"#app",
    data:{
      toggle:false
    },
    methods:{
      change(){
        this.toggle=!this.toggle
      }
    }
  })

  /*
    通过一个按钮控制 div 颜色的改变
    1.div 能改变颜色
    2.找一个数据和改变颜色做关联
    3.按钮控制这个数据的修改
    
  */ 


</script>
</html>